import { Component } from '@angular/core';
import { IonicPage, NavController } from 'ionic-angular';
import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';

@IonicPage()
@Component({
  selector: 'page-ionic-native',
  templateUrl: 'ionic-native.html',
})
export class IonicNativePage {

  rootPage: any;
  items: Array<{ title: string, page: any }>;

  constructor(public navCtrl: NavController, private nativePageTransitions: NativePageTransitions) {
    this.rootPage = 'IonicNativePage';

    this.items = [
      {
        title: 'Barcode scan',
        page: 'BarcodeScannerPage'
      },
      {
        title: 'Get image from camera/gallery',
        page: 'GetImagePage'
      },
      {
        title: 'Runtime permissions',
        page: 'RuntimePermissionsPage'
      },
    ];
  }

  itemTapped(event, item) {
    let options: NativeTransitionOptions = {
      direction: 'left',
      duration: 400,
      slowdownfactor: -1,
      iosdelay: 50
     };
 
    this.nativePageTransitions.slide(options);        
    this.navCtrl.push(item.page);
  }
}
